package com.hong.nsq;
/**
 *
 * 功能描述: 消费者
 *
 * @param:
 * @return:
 * @auther: csh
 * @date: 2021/6/3 15:19
 */
import com.sproutsocial.nsq.Subscriber;

public class Consumer {

    public static void handleData(byte[] data) {
        System.out.println("接收到的消息:" + new String(data));
    }

    public static void main(String[] args) {
        Subscriber subscriber = new Subscriber("localhost:4161");
        subscriber.subscribe("nsq_topic", "hong_channel", Consumer::handleData);
    }
}